from recipe_service import adjust_calories2, adjust_macronutrients2
if __name__ == "__main__":
    resipe = {
    "daily_recipe": {
        "carbohydrate_ratio": 0.5,
        "fat_ratio": 0.3,
        "protein_ratio": 0,
        "total_day_calories": 2856.4,
        "total_day_carbs": 347.4,
        "total_day_fat": 88,
        "total_day_protein": 122
    },
    "meals": [
        {
            "carbohydrate_ratio": 0.4,
            "fat_ratio": 0.4,
            "foodList": [
                {
                    "calories": 189.8,
                    "carbs": 16.6,
                    "category_1": "烹饪方式",
                    "category_2": "煮",
                    "description": "碳12.5g|蛋3.9g|脂9.4g",
                    "fat": 12.6,
                    "food_id": 13071746,
                    "image": "/images/groceries.png",
                    "note": "75.0g\n142.4kcal",
                    "protein": 5.2,
                    "quantity": 0.75,
                    "title": "饺子（猪肉芹菜馅）"
                },
                {
                    "calories": 351.0,
                    "carbs": 72.2,
                    "category_1": "食材",
                    "category_2": "零食",
                    "description": "碳72.2g|蛋12.8g|脂1.0g",
                    "fat": 1.0,
                    "food_id": 11042147,
                    "image": "/images/foods/lvdougao.jpg",
                    "note": "100.0g\n351.0kcal",
                    "protein": 12.8,
                    "quantity": 1.0,
                    "title": "绿豆糕"
                },
                {
                    "calories": 90.0,
                    "carbs": 7.4,
                    "category_1": "食材",
                    "category_2": "奶",
                    "description": "碳11.1g|蛋6.4g|脂7.2g",
                    "fat": 4.8,
                    "food_id": 11031712,
                    "image": "/images/groceries.png",
                    "note": "150.0g\n135.0kcal",
                    "protein": 4.3,
                    "quantity": 1.5,
                    "title": "牛奶（完达山牌）"
                },
                {
                    "calories": 302.0,
                    "carbs": 4.2,
                    "category_1": "食材",
                    "category_2": "肉蛋",
                    "description": "碳8.4g|蛋48.4g|脂42.0g",
                    "fat": 21.0,
                    "food_id": 11021848,
                    "image": "/images/groceries.png",
                    "note": "200.0g\n604.0kcal",
                    "protein": 24.2,
                    "quantity": 2.0,
                    "title": "鸡蛋（煮）"
                }
            ],
            "header": "早餐",
            "meal_id": 1,
            "protein_ratio": 0.2,
            "status": 1,
            "totalCalories": 932.8,
            "totalCarbs": 100.40000000000002,
            "totalFat": 39.4,
            "totalProtein": 46.5
        },
        {
            "carbohydrate_ratio": 0.6,
            "fat_ratio": 0.3,
            "foodList": [
                {
                    "calories": 814.0,
                    "carbs": 169.0,
                    "category_1": "食材",
                    "category_2": "零食",
                    "description": "碳338.0g|蛋10.0g|脂26.4g",
                    "fat": 13.2,
                    "food_id": 11042117,
                    "image": "/images/groceries.png",
                    "note": "200.0g\n1628.0kcal",
                    "protein": 5.0,
                    "quantity": 2.0,
                    "title": "奶糖"
                },
                {
                    "calories": 53.0,
                    "carbs": 11.8,
                    "category_1": "食材",
                    "category_2": "饮料",
                    "description": "碳11.8g|蛋0.9g|脂0.2g",
                    "fat": 0.2,
                    "food_id": 13071747,
                    "image": "/images/groceries.png",
                    "note": "100.0g\n53.0kcal",
                    "protein": 0.9,
                    "quantity": 1.0,
                    "title": "喜乐(乳酸饮料)"
                },
                {
                    "calories": 348.0,
                    "carbs": 6.5,
                    "category_1": "食材",
                    "category_2": "奶",
                    "description": "碳6.5g|蛋16.5g|脂28.4g",
                    "fat": 28.4,
                    "food_id": 11031722,
                    "image": "/images/groceries.png",
                    "note": "100.0g\n348.0kcal",
                    "protein": 16.5,
                    "quantity": 1.0,
                    "title": "奶酪（光明牌）"
                },
                {
                    "calories": 111.6,
                    "carbs": 3.4,
                    "category_1": "食材",
                    "category_2": "肉蛋",
                    "description": "碳4.1g|蛋26.8g|脂1.2g",
                    "fat": 1.0,
                    "food_id": 11021943,
                    "image": "/images/groceries.png",
                    "note": "120.0g\n133.9kcal",
                    "protein": 22.3,
                    "quantity": 1.2,
                    "title": "对虾"
                }
            ],
            "header": "午餐",
            "meal_id": 2,
            "protein_ratio": 0.1,
            "status": 0,
            "totalCalories": 1326.6,
            "totalCarbs": 190.70000000000002,
            "totalFat": 42.8,
            "totalProtein": 44.7
        },
        {
            "carbohydrate_ratio": 0.4,
            "fat_ratio": 0.1,
            "foodList": [
                {
                    "calories": 53.0,
                    "carbs": 0.6,
                    "category_1": "食材",
                    "category_2": "肉蛋",
                    "description": "碳0.3g|蛋5.0g|脂0.6g",
                    "fat": 1.1,
                    "food_id": 11021859,
                    "image": "/images/groceries.png",
                    "note": "50.0g\n26.5kcal",
                    "protein": 10.1,
                    "quantity": 0.5,
                    "title": "牛肉(瘦)"
                },
                {
                    "calories": 64.0,
                    "carbs": 0.0,
                    "category_1": "食材",
                    "category_2": "饮料",
                    "description": "碳0.0g|蛋1.6g|脂0.0g",
                    "fat": 0.0,
                    "food_id": 12062222,
                    "image": "/images/foods/pijiu_junzhi.jpg",
                    "note": "200.0g\n128.0kcal",
                    "protein": 0.8,
                    "quantity": 2.0,
                    "title": "啤酒"
                },
                {
                    "calories": 472.6,
                    "carbs": 54.2,
                    "category_1": "食材",
                    "category_2": "其他",
                    "description": "碳92.1g|蛋33.8g|脂7.8g",
                    "fat": 4.6,
                    "food_id": 11081550,
                    "image": "/images/groceries.png",
                    "note": "170.0g\n803.4kcal",
                    "protein": 19.9,
                    "quantity": 1.7,
                    "title": "肉桂"
                },
                {
                    "calories": 7.4,
                    "carbs": 1.5,
                    "category_1": "食材",
                    "category_2": "蔬果",
                    "description": "碳0.3g|蛋0.0g|脂0.0g",
                    "fat": 0.0,
                    "food_id": 11031819,
                    "image": "/images/groceries.png",
                    "note": "20.0g\n1.5kcal",
                    "protein": 0.2,
                    "quantity": 0.2,
                    "title": "李子杏"
                }
            ],
            "header": "晚餐",
            "meal_id": 3,
            "protein_ratio": 0.2,
            "status": 0,
            "totalCalories": 597.0,
            "totalCarbs": 56.300000000000004,
            "totalFat": 5.699999999999999,
            "totalProtein": 30.999999999999996
        }
    ]
}
    resipe = adjust_calories2(resipe, 1500)
    resipe = adjust_macronutrients2(resipe, 0.4, 0.3, 0.3)
    print(resipe)